﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="TaskForOa.aspx.cs" Inherits="MyWindow_TaskForOa" %>

<%@ Register Src="~/UserControls/JqueryDataGrid.ascx" TagPrefix="uc1" TagName="JqueryDataGrid" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>OA待办事项列表</title>
    <script src="../ScriptFile/jquery.js"></script>
    <script src="../ScriptFile/jquery.easyui.min.js"></script>
    <script src="../ScriptFile/Common/Jquery.Common.js"></script>
    <script src="../ScriptFile/Common/Jquery.Global.js"></script>
    <link href="../css/default/easyui.css" rel="stylesheet" />
    <link href="../css/icon.css" rel="stylesheet" />
    <script type="text/javascript">
        function GetGridColAttr() {
            var hidValue = "";
            var tabGrid = $('#tabResult').datagrid('options');
            if (tabGrid.columns.length > 0) {
                if (tabGrid.columns[0].length > 0) {
                    for (var i = 0; i < tabGrid.columns[0].length; i++) {
                        hidValue += tabGrid.columns[0][i].title + "☆" + tabGrid.columns[0][i].width;
                        if (i < tabGrid.columns[0].length - 1) {
                            hidValue += "★";
                        }
                    }
                }
            }
            if (hidValue != null && hidValue != "") {
                return hidValue;
            }
            else {
                return "";
            }
        }

        //带入url根据查询的数据返回csv
        function bsuExportXls() {
            //如果页面中没有用于下载iframe，增加iframe到页面中
            if ($('#downloadXsl').length <= 0)
                $('body').append("<iframe id=\"downloadXsl\" style=\"display:none\"></iframe>");
            $('#downloadXsl').attr('src', '../UserControls/JqueryDataGridExportXls.aspx?flag=1' + paramInfo);
        }

    </script>
</head>
<body>
    <form id="form1" runat="server">
        <div id="tabTools">
            <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-ok',plain:true">全选</a>
            <a href="#" class="easyui-linkbutton" onclick="bsuExportXls()" data-options="iconCls:'icon-redo',plain:true">导出Excel</a>
        </div>
        <table id="tabResult" style="width:90%">
        </table>

        <script type="text/javascript">
            var queryUrl = 'TaskForOaProcess.ashx';
           
            var definePs = 10;

            function ShowTable() {
                $('#tabResult').datagrid({
                    url: queryUrl,
                    toolbar: '#tabTools',
                    selectOnCheck: true,
                    checkOnSelect: true,
                    editable: false,
                    loadMsg: '正在读取数据...',
                    pageList: [definePs, definePs * 2, definePs * 3, definePs * 4, definePs * 5],
                    width: 'auto', height: 'auto', pagination: true, rownumbers: true, collapsible: true, pageSize: definePs, title: 'OA待办事项',
                    columns: [[
                        { field: 'TASKID', title: '编号', sortable: true, resizable: true, align: 'center', sortOrder: 'asc', width: 100, formatter: function (value, row, index) { return '<a href=\'http://10.20.17.30/jsp/ext/common/loginAndSend.jsp?userId=<%=strUserid%>&loadUrl=' + row.TASKURL + '\'>' + value + '</a>'; } },
                        { field: 'TASKNAME', title: '公文名称', sortable: true, resizable: true, align: 'center', sortOrder: 'asc', width: 250 },
                        { field: 'TASKTYPE', title: '公文类型', sortable: true, resizable: true, align: 'center', sortOrder: 'asc', width: 100 },
                        { field: 'APPROVALNAME', title: '申请人', sortable: true, resizable: true, align: 'center', sortOrder: 'asc', width: 100 },                       
                        { field: 'CREATORNAME', title: '创建人', sortable: true, resizable: true, align: 'center', sortOrder: 'asc', width: 100 },
                        { field: 'TASKCREATETIME', title: '创建时间', sortable: true, resizable: true, align: 'center', sortOrder: 'asc', width: 200 },
                        { field: 'ROWNO', title: '详情', sortable: true, resizable: true, align: 'center', sortOrder: 'asc', width: 100, formatter: function (value, row, index) { return '<a href=\'' + row.DETAILURL + '\'>' + value + '</a>'; } },
                    ]]
                });
                var p = $('#tabResult').datagrid('getPager');
                $(p).pagination({
                    displayMsg: '总共{total}条', beforePageText: '第', afterPageText: '页,共{pages}页'
                });
            }

            ShowTable();
        </script>

    </form>
</body>
</html>
